package vashion.azeroth.core.api.request;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

import com.alibaba.fastjson.annotation.JSONField;

public class AddCompletedRequest extends BaseRequest {

	/**
	 * 方法名
	 * */
	private @Setter @Getter String method = "gy.erp.trade.return.addCompleted";

	/**
	 * 会员代码
	 * */
	@JSONField(name = "vip_code")
	@NonNull
	private @Setter @Getter String vipCode;

	/**
	 * 店铺代码
	 * */
	@JSONField(name = "shop_code")
	@NonNull
	private @Setter @Getter String shopCode;

	/**
	 * 退换货类型
	 * */
	@JSONField(name = "traderefund_type_code")
	@NonNull
	private @Setter @Getter String traderefundTypeCode;

	/**
	 * 收件人
	 * */
	@JSONField(name = "receiver_name")
	@NonNull
	private @Setter @Getter String receiverName;

	/**
	 * 详细地址
	 * */
	@JSONField(name = "receiver_address")
	@NonNull
	private @Setter @Getter String receiverAddress;

	/**
	 * 手机号码
	 * */
	@JSONField(name = "receiver_mobile")
	@NonNull
	private @Setter @Getter String receiverMobile;

	/**
	 * 
	 * trade_return_order_detail商品列表
	 * */
	@JSONField(name = "trade_return_order_detail")
	@NonNull
	private List<TradeReturnOrderDetail> tradeReturnOrderDetail;

	// ---------------------以下参数可以为空------------------------
	/**
	 * 订单编号
	 * */
	@JSONField(name = "code")
	private @Setter @Getter String code;

	/**
	 * 平台单号
	 * */
	@JSONField(name = "platform_code")
	private @Setter @Getter String platformCode;
	/**
	 * 退入仓库代码
	 * */
	@JSONField(name = "warehouse_in_code")
	private @Setter @Getter String warehouseInCode;
	/**
	 * 换出仓库代码
	 * */
	@JSONField(name = "warehouse_out_code")
	private @Setter @Getter String warehouseOutCode;

	/**
	 * 退回快递
	 * */
	@JSONField(name = "express_id")
	private @Setter @Getter String expressId;
	/**
	 * 退回快递号
	 * */
	@JSONField(name = "express_code")
	private @Setter @Getter String expressCode;
	/**
	 * 备注
	 * */
	@JSONField(name = "note")
	private @Setter @Getter String note;
	/**
	 * 固定电话
	 * */
	@JSONField(name = "receiver_phone")
	private @Setter @Getter String receiverPhone;

	/**
	 * 邮政编码
	 * 
	 * */
	@JSONField(name = "receiver_zip")
	private @Setter @Getter String receiverZip;

	@Override
	public Boolean check() {

		if (StringUtils.isEmpty(vipCode)) {

			return false;
		}

		if (StringUtils.isEmpty(shopCode)) {

			return false;
		}

		if (StringUtils.isEmpty(traderefundTypeCode)) {

			return false;
		}

		if (StringUtils.isEmpty(receiverName)) {

			return false;
		}

		if (StringUtils.isEmpty(receiverAddress)) {

			return false;
		}

		if (StringUtils.isEmpty(receiverMobile)) {

			return false;
		}

		if (tradeReturnOrderDetail == null
				|| tradeReturnOrderDetail.size() == 0) {

			return false;
		}

		return true;
	}
}
